#include "Function.h"

Function::Function() : args(0), func(0)
{
}

Function::Function(const Function& f) : args(f.args), func(f.func)
{
}


Function::~Function()
{
//	if(args)
//		delete args;
}

//const Value& Function::call()
Value Function::call()
{
	try
		{
			if(func.empty())
				{
					std::cout << "INFO: tried calling a null function" << std::endl;
					return ::Value::null;
				}

			std::cout << "Function::call()" << std::endl;

//			Array< ::Value >* a = new Array< ::Value >();
//			a->push(Value(1));
//			a->push(Value(2.17f));
			
//			ValueType type = a->getType();
			
			if(args)
			std::cout << args->toString() << std::endl;

		}
	catch(std::exception& e)
		{
			std::cout << e.what() << std::endl;
		}
	catch(...)
		{
		}
//	return ::Value::null;
	return func(args);
}
